package com.yuanfengerp.salesReturn.controller;

import com.yuanfengerp.publicUtil.Result;
import com.yuanfengerp.salesReturn.model.salesReturn;
import com.yuanfengerp.salesReturn.service.ISalesReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
public class SalesReturnController {
    @Autowired
    private ISalesReturnService salesReturnService;
    @PostMapping("/insertSalesReturn")
    public Result<salesReturn> insertReturnOrder(salesReturn salesReturn){
        return salesReturnService.insertReturnOrder(salesReturn);
    }
    @PostMapping("/updateAgree")
    public Result<salesReturn> updateReturnOrderAgree(String[] salesReturnNumbers){
        return salesReturnService.updateReturnOrderAgree(salesReturnNumbers);
    }
    @PostMapping("/updateRefuse")
    public Result<salesReturn> updateReturnOrderRefuse(String[] salesReturnNumbers){
        return salesReturnService.updateReturnOrderRefuse(salesReturnNumbers);
    }
    @PostMapping("/selectAllSalesReturn")
    public Result<List<salesReturn>> selectAllReturnOrder(Map<String, Object> condition){
        return salesReturnService.selectAllReturnOrder(condition);
    }
    @PostMapping("/selectSalesReturn")
    public Result<salesReturn> selectReturnOrder(@PathVariable String salesReturnNumber){
        return salesReturnService.selectReturnOrder(salesReturnNumber);
    }
}
